
local ScreenScale = ScreenScale
local PANEL = {}

function PANEL:Init()
	
	self.pic = vgui.Create( "AvatarImage", self )
	self.pic:SetPos( ScreenScale( 3 ), ScreenScale( 3 ) )
	self.pic:SetSize( ScreenScale( 20 ), ScreenScale( 20 ) )
	self.drawcolor = Color( 100, 100, 100, 255 )

end

function PANEL:SetPlayer( ply )
	
	self.ply = ply
	self.name = ply:Nick()
	self.pic:SetPlayer( ply, ScreenScale( 20 ) )

end

function PANEL:GetPlayer()
	
	return self.ply
	
end

function PANEL:SetIsLeader( isleader )
	
	if isleader then self.drawcolor = Color( 200, 200, 200, 255 ) end
	if !isleader then self.drawcolor = Color( 100, 100, 100, 255 ) end
	
end

function PANEL:Paint()
	
	local words = self.name or "Player"
	draw.RoundedBox( 8, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
	draw.RoundedBox( 8, 1, 1, self:GetWide() - 2, self:GetTall() - 2, self.drawcolor )
	draw.SimpleTextOutlined( words, "ScoreboardText", ScreenScale( 31 ), self:GetTall()/2, Color( 255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, 1, Color( 0, 0, 0, 255 ))

end

function PANEL:PerformLayout()

	self:SetSize( ScreenScale( 115 ), ScreenScale( 26 ) )
	
end

vgui.Register( "OPCard", PANEL, "DPanel" )
// End of Definition
